package com.itbuka.canal.listener;

import com.itbuka.canal.config.RabbitConfig;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class AdRedisListener {
    @Autowired
    public RestTemplate restTemplate;

    @RabbitListener(queues = RabbitConfig.AD_QUEUE)
    public void message(Message message) {
        String forObject = restTemplate.getForObject("http://192.168.30.128/ad_load", String.class);
        System.out.println(forObject);
    }
}